<script lang="ts" setup>
import router from '@/router';
import { reactive } from 'vue';
import { useRoute } from 'vue-router'
import { filterDate } from '@/utils/format'
const route = useRoute()
let detailData = reactive({
  query: route.query
})
const goBack = () => {
  router.go(-1)
}
// 过滤活动类型
const filterActivityType = (val: number) => {
  switch (val) {
    case 0:
      return '社团活动'
    case 1:
      return '院级活动'
    case 2:
      return '校级活动'
  }
}
</script>

<template>
  <div class="detail-container">
    <el-page-header @back="goBack" :title="'返回'">
      <template #content>
        <span class="text-large font-600 mr-3">{{ detailData.query.name }} </span>
      </template>
    </el-page-header>
    <p class="detail-item item-time">
      <span>发布时间： {{ filterDate(String(detailData.query.createdAt)) }}</span>
      <span>
        活动人数： {{ detailData.query.planNumber }}
      </span>
      <span>
        活动类型：{{ filterActivityType(Number(detailData.query.type)) }}
      </span>
    </p>
    <p class="detail-item item-introduce">
      {{ detailData.query.introduce }}
    </p>
    <p class="detail-item item-img">
      <el-image style=" height: 400px" :src="detailData.query.imgurl" :zoom-rate="1.2"
        :preview-src-list="[detailData.query.imgurl]" fit="cover" />
    </p>
    <div class="flex detail-item items-center justify-end"><el-button type="primary">点击报名</el-button></div>
    <div class="flex  items-center justify-end item-next">
      <span>上一个</span>
      <el-link type="primary" link>志愿者爱好协会</el-link>
      <span>下一个</span>
      <el-link type="primary" link>街舞社</el-link>
    </div>
  </div>
</template>


<style lang="scss" scoped>
.detail-container {
  width: 80%;
  min-height: 45rem;
  background-color: #fff;
  padding: 2rem;
  color: #303133;

  .detail-item {
    margin: 1.4rem 0;
  }

  h3 {
    font-size: 1.8rem;
    font-weight: 700;
    text-align: center;
  }

  .item-time {
    color: #808080;
    font-size: 1.2rem;
    text-align: center;
  }

  .item-introduce {
    text-indent: 2em;
    font-size: 1.4rem;
    font-weight: 500;
    line-height: 3rem;
  }

  .item-img {
    width: 100%;
    text-align: center;

    img {
      width: 50%;
    }
  }

  .item-next {
    span {
      margin: 0 1rem;
      font-size: 1.4rem;
    }
  }
}
</style>
